<template>
  <div v-loading="loading" class="YpList">
    <el-form
      size="mini"
      ref="form"
      :model="form"
      label-position="top"
      class="myform"
    >
      <div>
        <el-form-item label="款号" class="myform-item">
          <el-input
            v-model="form.number"
            placeholder="请输入款号"
            @keyup.enter.native="onSearch"
            clearable
          ></el-input>
        </el-form-item>
        <el-form-item label="厂名" class="myform-item">
          <el-input
            v-model="form.title"
            placeholder="请输入厂名"
            @keyup.enter.native="onSearch"
            clearable
          ></el-input>
        </el-form-item>
        <el-form-item style="margin-top: 39px">
          <el-button type="primary" @click="onSearch">查询</el-button>
        </el-form-item>
      </div>
      <div></div>
    </el-form>
    <el-table :data="xpypList" size="small" border stripe>
      <el-table-column prop="img" label="图片" width="100">
        <template slot-scope="{ row }">
          <el-image
            v-if="row.img"
            :src="row.img"
            fit="contian"
            :preview-src-list="[row.img]"
          ></el-image>
        </template>
      </el-table-column>
      <el-table-column prop="name" label="款名" width="200">
        <template slot-scope="{ row }">
          <span
            style="color: #2c70d6"
            class="pointer"
            @click="clicktype_no(row.number)"
          >
            {{ row.name }}
          </span>
        </template>
      </el-table-column>
      <el-table-column prop="number" label="款号" width="200">
        <template slot-scope="{ row }">
          <span
            style="color: #2c70d6"
            class="pointer"
            @click="clicktype_no(row.number)"
          >
            {{ row.number }}
          </span>
        </template>
      </el-table-column>
      <el-table-column prop="f12_short" label="加工厂" width="200">
      </el-table-column>
      <el-table-column prop="f8_short" label="绣花厂" width="200">
      </el-table-column>
      <el-table-column prop="f9_short" label="印花厂" width="200">
      </el-table-column>
      <el-table-column prop="f10_short" label="烫金厂" width="200">
      </el-table-column>
      <el-table-column prop="f11_short" label="印金厂" width="200">
      </el-table-column>
      <el-table-column> </el-table-column>
    </el-table>
    <pagination
      :form="form"
      :total="total"
      @paginationPostOrderTaskList="postAdminOperategetnewarrangement"
    />
  </div>
</template>
    
<script>
import { postAdminOperategetnewarrangement } from "@/api";
import pagination from "@/components/pagination.vue";
export default {
  components: { pagination },

  data() {
    return {
      loading: false,
      xpypList: [],
      form: {
        number: "",
        title: "",
        page: 1,
        size: 10,
      },
      total: 0,
    };
  },
  activated() {
    this.postAdminOperategetnewarrangement(this.form);
  },
  methods: {
    async clicktype_no(e) {
      let number = await this.encrypt(e);
      this.$router.push({
        name: `CustomModuleRouter`,
        params: { path: `/CustomModuleDesignFilesDetail/${number}` },
      });
    },
    // 新品预排
    async postAdminOperategetnewarrangement(data) {
      this.loading = true;
      this.form = data;
      try {
        let res = await postAdminOperategetnewarrangement(this.form);
        this.xpypList = res.data;
        this.total = Number(res.total);
        this.loading = false;
      } catch (error) {
        this.loading = false;
      }
    },
    // 搜索
    onSearch() {
      this.form.page = 1;
      this.form.size = 10;
      this.postAdminOperategetnewarrangement(this.form);
    },
  },
};
</script>
<style lang="scss" scoped>
.myform {
  display: flex;
  justify-content: space-between;
  > div {
    display: flex;
  }
  &-item {
    margin-right: 10px;
  }
}
.YpList {
  background: #ffff;
  padding: 10px;
  font-size: 12px;
}
.attribute {
  width: 320px;
  display: flex;
  flex-wrap: wrap;
  > div {
    border: 1px solid #888080;
    border-radius: 2px;
    overflow: hidden;
    display: flex;
    margin-right: 4px;
    margin-bottom: 2px;
    > div {
      padding: 2px 6px;
    }
    > div:nth-child(1) {
      color: #ffffff;
      background: #888080;
      text-align: center;
    }
  }
}
</style>